﻿<!DOCTYPE html>
<html lang="en">

<head>
	<th:block th:include="include :: header('盘符管理')" />
</head>

<body>

            <div class="container-div">
				<div class="row">
				<!--
					<div class="col-sm-12 search-collapse">
						<form id="form1">
							<div class="select-list">
								<ul>
									<li>
										用户名称：<input type="text" name="userName"/>
									</li>
									<li>
										<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('form1', 'bootstrap-table1')"><i class="fa fa-search"></i>&nbsp;搜索</a>
										<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('form1', 'bootstrap-table1')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
									</li>
								</ul>
							</div>
						</form>
					</div>
					
					<div class="btn-group-sm" id="toolbar1" role="group">
						<a class="btn btn-success" onclick="options1()">
							<i class="fa fa-search"></i> options
						</a>
						<a class="btn btn-success" onclick="$.operate.add()">
							<i class="fa fa-plus"></i> 新增
						</a>
						<a class="btn btn-primary single disabled" onclick="$.operate.edit()">
							<i class="fa fa-edit"></i> 修改
						</a>
						<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
							<i class="fa fa-remove"></i> 删除
						</a>
					</div>
					-->
					<div class="col-xs-12 select-table table-striped">
						<table id="bootstrap-table1"></table>
					</div>
				</div>
			</div>
    
<th:block th:include="include :: footer" />
    <script th:inline="javascript">
        //var prefix = "http://127.0.0.1/demo/operate";
        //var datas = [[${@dict.getType('sys_normal_disable')}]];
		
		var data = {
			"total": 26,
			"rows": [
				{
					"diskLabeId": 1,
					"diskLabelCapacity": "100G",
					"diskLabelName": "测试1",
					"diskLabelFree": "100M",
					"status": "0"
				},
				{
					"diskLabeId": 2,
					"diskLabelCapacity": "100G",
					"diskLabelName": "测试2",
					"diskLabelFree": "200M",
					"status": "1"
				}
			],
			"code": 0,
			"msg": null
		}
		
        $(function() {
            var options = {
            	id: "bootstrap-table1",
            	formId: "form1",
            	//toolbar: "toolbar1",
                //url: prefix + "/list",
                //createUrl: prefix + "/add",
                //removeUrl: prefix + "/remove",
                //updateUrl: prefix + "/edit/{id}",
				data:data,
		        modalName: "用户",
                columns: [{
					field : 'diskLabeId', 
					title : '盘符ID'
				},
				{
					field : 'diskLabelName', 
					title : '盘符号'
				},
				{
					field : 'diskLabelCapacity', 
					title : '总容量'
				},
				{
					field : 'diskLabelFree', 
					title : '可用总容量'
				},
				{
                    field: 'status',
                    title: '容量状态',
                    align: 'center',
                    formatter: function(value, row, index) {
						if(value == 0){
							return "<span class='badge badge-primary'>良好</span>";
						}else{
							return "<span class='badge badge-danger'>警告</span>";
						}
                    	
                    }
                },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	//actions.push('<a class="btn btn-success btn-xs" href="###" onclick="$.operate.edit(\'' + row.userId + '\')"><i class="fa fa-remove"></i>磁盘操作</a> ');
                        actions.push('<a class="btn btn-success btn-xs" href="###" onclick="fileOpreat(\'' + row.diskLabelName + '\')"><i class="fa fa-edit"></i>文件操作</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        
		function fileOpreat(diskLabelName){
				var options = {
	                title: '文件操作',
	                url: "/hddata/getFileOperatePage",
					width: 1000,
	                height: 800,
	                callBack: fileBack
	             };
	             $.modal.openOptions(options);
		}
		
		function fileBack(index, layero){
			$.modal.close(index);
		}
		
    </script>

</body>

</html>